var columns = [
    {field: 'id',title: '序号',
        formatter:function(value, row, index){
            return index + 1 + (row.pageNumber-1)*row.pageSize;
        }
    },
    //{field: 'id',title: '序号'},
    {field: 'auditorId',title: '审核人ID'},
    {field: 'auditorName',title: '审核人'},
    {field: 'userId',title: '申请人ID'},
    {field: 'userName',title: '申请人'},
    {field: 'lessonName',title: '课程名称'},
    {field: 'lessonNumber',title: '课表名称'},
    {field: 'createTime',title: '请假时间'},
    {field: 'status',title: '请假状态',class:'col-width-state',
        formatter: function (value, row) {
            return pubForm.getLeaveStatus(row);
        }
    },
    {field: 'reason',title: '请假原因'}];

var leave={
    init:function() {
        var auditorId = $("#auditorId").val();
        var userId = $("#userId").val();
        var status = $("#status").val();
        var startTime = $("#startTime").val();
        var endTime = $("#endTime").val();
        var parmsObj = {};
        parmsObj.auditorId=auditorId;
        parmsObj.userId=userId;
        parmsObj.status=status;
        parmsObj.startTime=startTime;
        parmsObj.endTime=endTime;
        pubForm.getBootTable("#tableLeaveList","/base/leave/queryLeaveList?auditorId="+auditorId+"&userId="+userId+"&status="+status+"&startTime="+startTime+"&endTime="+endTime,null,parmsObj);
    },
    refreshTabel:function () {
        var size = $(".page-size").text();
        var auditorId = $("#auditorId").val();
        var userId = $("#userId").val();
        var status = $("#status").val();
        var startTime = $("#startTime").val();
        var endTime = $("#endTime").val();
        var opt = {
            url: application.contextPath + "/base/sign/querySignList",
            query: {
                size: size,
                page: 1,
                auditorId:auditorId,
                userId:userId,
                status:status,
                startTime:startTime,
                endTime:endTime
            },
            silent: true
        };
        $("#tableLeaveList").bootstrapTable('refreshOptions',opt);
    },
    queryLeaveByMap:function () {
        var size = $(".page-size").text();
        var auditorId = $("#auditorId").val();
        var userId = $("#userId").val();
        var status = $("#status").val();
        var startTime = $("#startTime").val();
        var endTime = $("#endTime").val();

        var opt = {
            url: application.contextPath + "/base/leave/queryLeaveList?auditorId="+auditorId+"&userId="+userId+"&status="+status+"&startTime="+startTime+"&endTime="+endTime,
            query: {
                size: size,
                page: 1
            },
            silent: true
        };
        $('#tableLeaveList').bootstrapTable('refreshOptions', opt);

    }
};

$(document).ready(function(){
    leave.init();
});